<template>
  <view class="home-page">
    <!-- 项目经理 -->
    <projectManager v-if="role==1"></projectManager>
    <!-- 主管部门 -->
    <departmentManager v-if="role==2"></departmentManager>
		<!-- 企业账号 -->
		<qyhomeManager v-if="role==3"></qyhomeManager>
		<u-toast ref="uToast"></u-toast>
  </view>
</template>

<script>
  /* @Description: 优化首页
   * @Author: Yinchy
   * @CreatDate: 2022-11-24 11:16:20
   * @Params: 
   */
  import projectManager from '@/pages/main/home/roles/projectManager.vue'
  import departmentManager from '@/pages/main/home/roles/departmentManager.vue'
  import qyhomeManager from '@/pages/main/home/roles/qyhomeManager.vue'
	
  export default { 
    components: {
			projectManager,
			departmentManager,
			qyhomeManager,
    },
		onLoad(options) {
			let auth = uni.getStorageSync('auth');
			if(auth){
				this.role = auth;
			}else{
				this.$refs.uToast.show({
					type: "error",
					message: "未登录",
					complete(){
						uni.reLaunch({
							url: '/pages/main/login/login'
						})
					}
				})
			}
		},
    data() {
      return {
        role: 0,//1-项目经理 2-主管部门 3-企业账号
      }
    }
  }
</script>
